package com.luoy.util;

import java.math.BigInteger;
import java.security.SecureRandom;

/**
 * TOKEN
 *
 * @author luoyuan
 * @create 2018-06-04-下午5:21
 */
public class TokenUtil {
    public static String getToken() {
        SecureRandom ng = new SecureRandom();
        byte[] randomBytes = new byte[16];
        ng.nextBytes(randomBytes);
        randomBytes[6] &= 0x0f;
        randomBytes[6] |= 0x40;
        randomBytes[8] &= 0x3f;
        randomBytes[8] |= 0x80;
        return new BigInteger(1, randomBytes).toString(16);
    }
}
